package lab01;

import java.util.Scanner;

public class Test0601 {

        public static void main(String[] args) {

//用if-else语句实现

            Scanner scanner = new Scanner(System.in);

            int score ;

            System.out.println("if-else语句，请输入成绩：");

            score = scanner.nextInt();

            String str="";

//判断成绩，输出表现
            if(score==1) {
                str= "不及格";
            }

            if(score==2) {
                str= "及格";
            }

            if(score==3){
                str="中等";
            }

            if(score==4){
                str="良好";
            }

            if(score==5){
                str="优秀";
            }
            System.out.println("成绩为"+score+"的等级为："+str);

            System.out.println();

//switch实现
            int grade;

            System.out.println("switch语句，请输入成绩：");

            grade = scanner.nextInt();

            int i=0;

            String st="";

            i=grade/1;

            switch(i){

                case 1:
                    st="不及格";break;

                case 2:
                    st="及格";break;

                case 3:
                    st="中等";break;

                case 4:
                    st="良好";break;

                case 5:
                    st="优秀";break;

            }
            System.out.println("成绩"+grade+"的等级为："+st);
        }

}


